//
//  TBCReadingCollectionViewCell.m
//  待定
//
//  Created by BoyaLee on 15/11/9.
//  Copyright © 2015年 BoyaLee. All rights reserved.
//

#import "TBCReadingCollectionViewCell.h"
#import "TBCReading.h"

@implementation TBCReadingCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        
    }
    
    return self;
    
}

- (void)initReadingCollectionCellViews {
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 10, (WIDTH - 75) / 3, (HEIGHT - 64) * 0.2 - 20)];
    imageView.backgroundColor = [UIColor lightGrayColor];
    [imageView sd_setImageWithURL:[NSURL URLWithString:_reading.coverimg] placeholderImage:[UIImage imageNamed:@"PlaceHolderImage@2x"]];
    imageView.layer.masksToBounds = YES;
    imageView.layer.cornerRadius = 10;
    [self.contentView addSubview:imageView];
    
    BaseLabel *label = [[BaseLabel alloc] initWithFrame:CGRectMake(0, (HEIGHT - 64) * 0.2 - 40, (WIDTH - 75) / 3, 20)];
    label.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1];
    label.text = _reading.name;
    label.textColor = [UIColor whiteColor];
    label.textAlignment = NSTextAlignmentCenter;
    [imageView addSubview:label];
    
}

- (void)setReading:(TBCReading *)reading {
    
    _reading = reading;
    
    [self initReadingCollectionCellViews];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
